package com.haoshuang.zhouzhoubang.ui.page.welfare.insure.record

import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemInsureApplyRecordBinding
import com.haoshuang.zhouzhoubang.model.bean.InsureApplyRecordBean
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.gone
import com.mufeng.libs.utils.view.load
import com.mufeng.libs.utils.view.textColor
import com.mufeng.libs.utils.view.visible


/**
 * 
 */
class InsureApplyRecordAdapter(data: MutableList<InsureApplyRecordBean>) : BaseBindingQuickAdapter<InsureApplyRecordBean, ItemInsureApplyRecordBinding>(data) {

    override fun onBindViewHolder(holder: BaseBindingHolder, position: Int, item: InsureApplyRecordBean?) {
        holder.getViewBinding<ItemInsureApplyRecordBinding>().apply {
            tvAccount.text = item?.account
            tvName.text = item?.real_name
            tvPhone.text = item?.mobile
            ivIDCard.load(item?.card_front)
            ivIDCardBack.load(item?.card_side)
            tvApplyTime.text = item?.add_time
            tvStatus.text = when(item?.status){
                0 -> {
                    tvStatus.textColor = R.color.c_ffffcc00
                    llRefuseTime.gone()
                    llRefuseReason.gone()
                    "审核中"
                }
                1 -> {
                    tvStatus.textColor = R.color.c_28CD41
                    llRefuseTime.gone()
                    llRefuseReason.gone()
                    "已通过"
                }
                else -> {
                    tvStatus.textColor = R.color.c_ff0000
                    llRefuseTime.visible()
                    llRefuseReason.visible()
                    tvRefuseTime.text = item?.check_time
                    tvRefuseReason.text = item?.remark
                    "已拒绝"
                }
            }
        }
    }

}